package com.example.leetcode.tree;

import com.example.leetcode.linkedlist.common.LinkedListUtils;
import com.example.leetcode.linkedlist.common.ListNode;
import com.example.leetcode.tree.common.TreeNode;
import com.example.leetcode.tree.common.TreeUtils;

class Solution109 {
    public TreeNode sortedListToBST(ListNode head) {
        return TreeUtils.sortedListToBST(head);
    }
}

public class leetcode109 {
    public static void main(String[] args) {
        Solution109 solution109 = new Solution109();
        int[] nums = {-10, -3, 0, 5, 9};
        test109(solution109, nums);
    }

    private static void test109(Solution109 solution109, int[] nums) {
        TreeNode root = solution109.sortedListToBST(LinkedListUtils.generateLinkedListByArray(nums));
        System.out.println(TreeUtils.getLeetcodeTreeVals(root));
    }
}
